<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">

	<ui:define name="head">
		<style type="text/css">
		
			.ui-datatable-scrollable-header-box {
				margin-left: 0px;
				margin-right: 15px !important;
			}
			
			.red {
				background-color: #CD5C5C;
			}
			.yellow {
				background-color: #FFFF00;
			}
			.blue {
				background-color: #B0E0E6;
			}
			.blank {
			}
		</style>
		<script>
			function openHiddenTrackDetail(rectificationPlanId,status) {
				MyModal.showModal("/ui/equipmentAssessment/assessmenthiddendanger/dialog/rectificationPlanDetailDialog.xhtml?status="+status +"&amp;rectificationPlanId="+rectificationPlanId);
			}
		</script>
	</ui:define>
	
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="headForm">
				<div class="box-header" id="queryDiv">
					<p:autoComplete id="planSearch" dropdown="true" scrollHeight="400" placeholder="计划查询" style="margin-right:10px"
						value="#{rectificationPlanController.queryParam.inspectionPlanName}"
						completeMethod="#{rectificationPlanController.completePlan}" size="28" />
						
					<p:autoComplete id="stationSearch" dropdown="true" scrollHeight="400" placeholder="变电站首字母查询" style="margin-right:10px"
						value="#{rectificationPlanController.queryParam.stationName}"
						completeMethod="#{rectificationPlanController.completeStation}" />
					
					<p:outputLabel value="是否完成：" />
					<h:selectOneMenu id="isFinish" style="width:80px;margin-right:10px;height:30px"
						value="#{rectificationPlanController.queryParam.status}" >
						<f:selectItem itemLabel="全部" itemValue="" />
						<f:selectItem itemLabel="完成" itemValue="1" />
						<f:selectItem itemLabel="未完成" itemValue="0" />
					</h:selectOneMenu>
					
					<p:commandButton value="查询" update="form:dataTb" icon="ui-icon-search" oncomplete="closeSelectDiv();"
						actionListener="#{rectificationPlanController.query}" style="margin-left:10px;" />
					
					<p:commandButton icon="ui-icon-refresh" value="重置" style="margin-left:5px;"
						actionListener="#{rectificationPlanController.resetQuery}"
						oncomplete="closeSelectDiv();"
						update=" stationSearch isFinish voltageLevel popup1 popup2 form:dataTb expert planSearch" />
					<div class="box-tools pull-right">
						<button type="button" id="selectButton" title="高级查询"
							class="btn btn-default" onclick="onSelectDivClick();"
							style="margin-right: 50px;">
							<span id="selectButtonIcon" class="fa fa-caret-down">高级查询</span>
						</button>
					</div>
				</div>
				<div class="panel-collapse collapse" id="selectDiv">
				
					<p:outputLabel for="popup1" value="计划完成时间：" style="margin-left:10px"/>
					<p:calendar id="popup1" navigator="true" pattern="yyyy-MM-dd" size="12"
						value="#{rectificationPlanController.queryParam.planStartDate}" />
					<p:outputLabel for="popup2" value="至 " style="margin-right:5px;margin-left:5px;" />
					<p:calendar id="popup2" navigator="true" pattern="yyyy-MM-dd" size="12"
						value="#{rectificationPlanController.queryParam.planFinishDate}" />
					
					<p:outputLabel value="电压等级：" style="margin-left:10px;" />
					<h:selectOneMenu id="voltageLevel"
						value="#{rectificationPlanController.queryParam.voltage}"
						style="width:120px;height:30px">
						<f:selectItem itemLabel="全部" itemValue="" />
						<f:selectItem itemLabel="500kV及以上" itemValue="499" />
						<f:selectItem itemLabel="220kV及以下" itemValue="221" />
					</h:selectOneMenu>
					<p:outputLabel value="检查专家：" style="margin-left:10px;" />
					<p:autoComplete  id="expert" dropdown="true" placeholder="输入专家首字母查询" scrollHeight="400"
						value="#{rectificationPlanController.queryParam.inspectionExpertName}" style="margin-right:20px;"
						completeMethod="#{rectificationPlanController.completeExpert}" />
				</div>
				<div id="toolbarDiv">
					<p:toolbar id="toolbar">
						<f:facet name="left">
							<p:commandButton value="详情" icon="ui-icon-document"  
								disabled="#{rectificationPlanController.selected == null}"
								oncomplete="openHiddenTrackDetail('#{rectificationPlanController.selected.id}','false')" />
							<p:commandButton value="编辑" icon="ui-icon-pencil"  
								rendered="#{s:hasPermission(session,'dwfxpg_sbyhgl_zgjh_bj')}"
								disabled="#{rectificationPlanController.selected == null}"
								oncomplete="openHiddenTrackDetail('#{rectificationPlanController.selected.id}','true')" />	 
							<p:commandButton value="删除" icon="ui-icon-trash"
								rendered="#{s:hasPermission(session,'dwfxpg_sbyhgl_zgjh_sc')}"
								actionListener="#{rectificationPlanController.delete}"
								disabled="#{rectificationPlanController.selected == null}"
								oncomplete="closeSelectDiv();"
								update=":form:dataTb :form:msgs :headForm:toolbar">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div class="box box-solid with-border">
			<h:form id="form">
				<p:growl id="msgs" showDetail="true" />
				<p:dataTable id="dataTb" rows="20" paginator="true" 
					paginatorTemplate="{left} {RowsPerPageDropdown} {right} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Customer}"
					rowsPerPageTemplate="20,30,50" paginatorPosition="bottom" rowKey="#{plan.id}"
					value="#{rectificationPlanController.allRectificationPlans}" var="plan" rowIndexVar="ite"
					scrollable="true" emptyMessage="无记录" selection="#{rectificationPlanController.selected}"
					rowStyleClass="#{rectificationPlanController.getRowClass(plan)}" sortBy="#{plan.planStartDate}">
					<f:facet name="{Customer}">
						<p:outputLabel value="总计：#{rectificationPlanController.allRectificationPlans.size()}条纪录"
							style="margin-left:20px" />
					</f:facet>
					<f:facet name="{left}">
						<p:outputLabel value="每页显示" />
					</f:facet>
					<f:facet name="{right}">
						<p:outputLabel value="条" style="margin-right:20px" />
					</f:facet>
					<p:ajax event="rowSelectRadio" listener="#{rectificationPlanController.onRowSelect}" update=":headForm:toolbar" />
					<p:column selectionMode="single" width="10" style="text-align:center" />
					<p:column headerText="序号 " style="text-align:center;" width="30">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="计划" >
						<h:outputText value="#{plan.inspectionPlanName}" />
					</p:column>
					<p:column headerText="检查站" >
						<h:outputText value="#{plan.stationName}" />
					</p:column>
					<p:column headerText="问题设备" >
						<h:outputText value="#{plan.equipmentName}" />
					</p:column>
					<p:column headerText="问题描述" width="200">
						<h:outputText value="#{plan.problemDescription}" style="white-space:pre-wrap;" escape="false"/>
					</p:column>
					<p:column headerText="整改建议" width="200">
						<h:outputText value="#{plan.recommendation}"  style="white-space:pre-wrap;" escape="false"/>
					</p:column>
					<p:column headerText="提出人员" >
						<h:outputText value="#{plan.inspectionExpertName}" />
					</p:column>
					<p:column headerText="整改计划开始时间" >
						<h:outputText value="#{plan.planStartDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="整改计划完成时间" >
						<h:outputText value="#{plan.planFinishDate}" >
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="是否整改" >
						<h:outputText value="#{plan.status == 1?'已整改':'未整改 '}" />
					</p:column>
					<p:column headerText="整改人员" >
						<h:outputText value="#{plan.rectificationPersonName}" />
					</p:column>
					<p:column headerText="负责人" >
						<h:outputText value="#{plan.personInChargeName}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<!-- <h:form id="editForm">
				<p:dialog widgetVar="editDlg" modal="true" id="editDlg" width="800"
					height="500">
					<p:toolbar>
						<f:facet name="left">
							oncomplete="afterCreate();"除了关闭当前dialog，还需要重新设置页面格式
							<p:commandButton value="保存" style="float: right;"
								icon="fa fa-floppy-o"
								actionListener="#{alarmMessageCheckController.save()}"
								oncomplete="afterCreate();" />
						</f:facet>
					</p:toolbar>
					具体内容
				</p:dialog>
			</h:form> -->
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script type="text/javascript" src="/resources/plugins/layer/layer.js" />
		<script type="text/javascript" src="/resources/js/mymodal.js" />
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>